package com.cyy.cn.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import com.cyy.cn.pojo.Article;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

/**
 * article数据访问接口
 * @author Administrator
 *
 */
public interface ArticleDao extends JpaRepository<Article,String>,JpaSpecificationExecutor<Article>{

    /**
     * 删除修改必须加上@Modifying，通知这是一个事务操作
     * @param id
     */
    @Modifying
    @Query("update Article set state = 3 where id = ?1 ")
    public void updateData(String id);

    @Modifying
    @Query("update Article set thumbup=thumbup+1 where id = ?1")
    public int updateThumbup(String id);
}
